
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<span style="font-size:18px;">
<html>
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" type="text/css" href="weddingPhotography/css/bootstrap.min.css" />
    <link rel="stylesheet" type="text/css" href="weddingPhotography/css/commonly-used-show.css" />
    <script type="text/javascript" src="weddingPhotography/js/jquery.min.js"></script>
    <script type="text/javascript" src="weddingPhotography/js/bootstrap.js" ></script>

    <title>我的图片文件</title>

    <style>
        .mydiv{
            text-align: center;
            margin-left: 10px;
            margin-top: 10px;
            float: left
        }
    </style>
</head>

<body class="mybody">

 <jsp:include page="theTopMenuUser.jsp" />


 <div class="container-fluid">
    <div class="row">


        <div class="col-md-12">
            <div class="col-md-12">
                    <div class="panel panel-primary">
                        <div class="panel-body">


                            <div >
     <h3 style="text-align: center">我的图片文件</h3>
     <hr style="filter: alpha(opacity=100,finishopacity=0,style=3)" width="100%" color="#6f5999" size="3"/>
     <div id="imgs" style="margin-left: 8%; margin-right: 5%">

     </div>

                                 <div class="text-center">
            <label id="user_null" style="color: red"></label>
        </div>
</div>


                        </div>
                    </div>
                </div>
        </div>



    </div>

 </div>



<script type="text/javascript">
    var userdt = JSON.parse(sessionStorage.getItem("user"));
    var userNull = document.getElementById("user_null");
    if (userdt.result.userName != null){
        $("#usname").text(userdt.result.userName);
    }else {
        $("#usname").text(userdt.result.userLoginName);
    }

    window.onload = function(){
        photoInfo();
    }

    function photoInfo(){
        var postUrl = "${pageContext.request.contextPath}/member/selectMenusIdAll";
        var str = {
            "userId": userdt.result.id
        };

        $.ajax({
            type:"post",
            url:postUrl,
            headers: {
                "Content-Type":"application/json"
            },
            data:JSON.stringify(str),
            contentType: "application/json; charset=utf-8",
            dataType:"json",
            success:function(data){
                if (data.status == "0"){
                    userNull.innerHTML = data.msg;
                }else {
                    imgShow(data);
                }
            },
            error:function(xhr,state,errorThrown){
                //alert("发生网络错误，错误码为：" + xhr.status)
                location.href = "${pageContext.request.contextPath}/error";
            }
        });
    }

    function imgShow(list){
        var j = 0;
        for(var i = 0; i < list.result.length; i++){

            j++;
            $("#imgs").append("<div class=\"mydiv\"><a href='${pageContext.request.contextPath}/managementPhoto?menu=" + list.result[i].moduleName + "'><img src='" + "weddingPhotography/img/img_folder.png" + "' width=\"150px\" height=\"150px\" ></a>" +
                "<br><p>" + list.result[i].moduleName + "</p></div>");
            if(j === 5){
                j = 0;
            }

        }
    }


</script>

</body>
</html>
</span>